<?php

/**
 * Mediad co,ltd
 *
 * @category   Mediad
 * @package    Mediad2_Controller_Plugin
 * @subpackage Smarty
 * @copyright  Copyright (c) 2012 Mediad co,ltd. (http://www.Mediad.cn)
 * @license    New BSD License
 * @version    $Id: DbTable.php 1 2012-02-15 11:47:00Z tany@Mediad.cn $
 */
class Mediad2_Controller_Plugin_Smarty extends Zend_Controller_Plugin_Abstract
{
    public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
    {
        //get variables
    	
        $moduleName = $request->getModuleName();
        
        $templates = APPLICATION_PATH . '/templates/' . $moduleName . '/templates';        
        
        //set viewRenderer object
        $view = Zend_Registry::get('view');

		$view->setScriptPath($templates);
        
        $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view);
		$viewRenderer->setViewSuffix('tpl');
		Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
		
    }
    
}

